public class Animal {
    public String name;
    public Animal(String name){
        this.name = name;
    }
    public static void play(Animal a){
        System.out.println(a.name + "正在玩耍！");
    }
    public void eatFood()
    {
        System.out.println(this.name + "正在吃饭！");
    }
}
class Dog extends Animal{
    public int age;
    public Dog(String name){
        super(name);
    }

    @Override
    public void eatFood(){
        System.out.println(this.name + "正在吃狗粮！");
    }
    public Animal run(){
        System.out.println(this.name + "正在奔跑！");
        return new Dog("另外一只狗子");
    }
    public void bark(){
        System.out.println(this.name + "正在汪汪叫！");
    }

}
class Panda extends Animal{
    public Panda(String name){
        super(name);
    }

    @Override
    public void eatFood() {
        System.out.println(this.name + "正在吃竹子！");
    }
}
class Bird extends Animal{
    public Bird(String name){
        super(name);
    }
    public void fly(){
        System.out.println(this.name + "正在飞！");
    }
}
class Test{
    public static void main(String[] args) {
        Animal a = new Panda("熊猫");
        Animal b = new Dog("小狗");

        a.eatFood();
        b.eatFood();
//        Animal a = new Bird("小鸟");
//        ((Bird) a).fly();
//
//        Animal a2 = new Dog("狗子");
//        if(a2 instanceof Bird){
//            ((Bird)a2).fly();
//        }else{
//            System.out.println("a2是狗子转型过来的，不能飞");
//        }

//        Dog d = new Dog("狗子");
//        Animal.play(d);

//        Animal a1 = new Dog("狗子");
//        Animal a2 = new Panda("熊猫");


    }
}